//
//  SendLogisticsViewController.m
//  Logistics
//
//  Created by 锋 on 2018/1/24.
//  Copyright © 2018年 HUYU. All rights reserved.
//

#import "SendLogisticsViewController.h"
#import "LTPickerView.h"
#import "CircleLogisticsTopModel.h"
#import "TZImagePickerController.h"
#import "ReleaseNotesViewController.h"

@interface SendLogisticsViewController ()<UITableViewDelegate, UITableViewDataSource, UICollectionViewDelegate, UICollectionViewDataSource, UITextViewDelegate, TZImagePickerControllerDelegate, KSPhotoBrowserDelegate>
{
    CGFloat pictureCellHeight;
    BOOL agreementIsSelect;
    NSMutableArray *photoArr;
}
@property (nonatomic, strong) UITableView *sendTableView;
@property (nonatomic, strong) UICollectionView *pictureCollectionView;
@property (nonatomic, strong) UITextView *textView;
@property (nonatomic, strong) NSString *textViewStr;
@property (strong, nonatomic) UILabel *placeholderLabel;
@property (strong, nonatomic) UILabel *countLabel;
@property (nonatomic, strong) NSMutableArray *imageArr;
@property (nonatomic, strong) NSString *typeStr;
@property (nonatomic, assign) NSInteger typeNum;
@end

@implementation SendLogisticsViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    photoArr = @[].mutableCopy;
    _typeNum=-1;
    agreementIsSelect = YES;
    pictureCellHeight = 85*displaywidth;
    self.imageArr = @[].mutableCopy;
    [self setupUI];
    [self setupSendTableView];
    // Do any additional setup after loading the view from its nib.
}

- (void)viewDidDisappear:(BOOL)animated {
    _typeNum=-1;
}

- (void)setupUI {
    self.navigationController.navigationBar.translucent = NO;
    self.navigationItem.title = @"发布物流圈";
    self.view.backgroundColor = BacksColor;
    UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(keyboardHide:)];
    singleTap.cancelsTouchesInView = NO;
    [self.view addGestureRecognizer:singleTap];
}

-(void)keyboardHide:(UITapGestureRecognizer*)tap {
    [self.view endEditing:YES];
}

- (void)setupSendTableView {
    self.sendTableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT - STA_NAV_HEIGHT - SCREER_HeiX) style:UITableViewStyleGrouped];
    _sendTableView.delegate = self;
    _sendTableView.dataSource = self;
    UIView *view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 0.000001)];
    view.backgroundColor = [UIColor whiteColor];
    _sendTableView.tableHeaderView = view;
    UIView *footerView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 170*displaywidth)];
    UIButton *agreement = [ZCControl createButtonWithFrame:CGRectMake(15*displaywidth, 11*displaywidth, 160*displaywidth, 20*displaywidth) ImageName:@"gouxuan2" Target:self Action:@selector(agreementAction:) Title:@"承诺此信息真实，不虚假" Font:12.0];
    agreement.imageEdgeInsets = UIEdgeInsetsMake(0, -5, 0, 0);
    agreement.titleEdgeInsets = UIEdgeInsetsMake(0, 5, 0, 0);
    [agreement setTitleColor:UIColorHexValue(0xFFAEAEAE) forState:UIControlStateNormal];
    [footerView addSubview:agreement];
    UIButton *sendTipBtn = [ZCControl createButtonWithFrame:CGRectMake(175*displaywidth,11*displaywidth, 100*displaywidth, 20*displaywidth) ImageName:@"" Target:self Action:@selector(sendAgreementAction) Title:@"《发布须知》" Font:12.0];
    sendTipBtn.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
    [sendTipBtn setTitleColor:ThemeColor forState:UIControlStateNormal];
    [footerView addSubview:sendTipBtn];
    UIButton *sendBtn = [ZCControl createButtonWithFrame:CGRectMake(15*displaywidth, 116*displaywidth, SCREEN_WIDTH-30*displaywidth, 44*displaywidth) ImageName:nil Target:self Action:@selector(onClickSendBtn) Title:@"立即发布" Font:18];
    sendBtn.layer.cornerRadius = 5;
    sendBtn.layer.masksToBounds = YES;
    sendBtn.backgroundColor = UIColorHexValue(0xFFFF9914);
    [sendBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    footerView.backgroundColor = [UIColor clearColor];
    [footerView addSubview:sendBtn];
    _sendTableView.tableFooterView = footerView;
    _sendTableView.backgroundColor = BacksColor;
    if (@available(iOS 11.0, *)) {
        self.sendTableView.contentInsetAdjustmentBehavior = UIScrollViewContentInsetAdjustmentNever;
    }else {
        self.automaticallyAdjustsScrollViewInsets = NO;
    }
    self.sendTableView.estimatedRowHeight = 0;
    self.sendTableView.estimatedSectionHeaderHeight = 0;
    self.sendTableView.estimatedSectionFooterHeight = 0;
    [self.view addSubview:_sendTableView];
}

// MARK:tableview的方法
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 4;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return 1;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.section == 0 || indexPath.section == 3)
    {
        return 44*displaywidth;
    } else if (indexPath.section == 1) {
        return 205*displaywidth;
    } else if (indexPath.section == 2) {
        NSInteger itemWidth = 85*displaywidth;
        if (_imageArr.count>2) {
            return (_imageArr.count/3+1)*itemWidth+80*displaywidth+_imageArr.count/3*15*displaywidth;
        } else {
            return itemWidth+80*displaywidth;
        }
    }
    return 44*displaywidth;
}

-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section {
    return 10*displaywidth;
}

-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section {
    return 0.000001;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    if (!cell)
    {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:@"cell"];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    if (indexPath.section == 0)
    {
        UILabel *typeLabel = [ZCControl createLabelWithFrame:CGRectMake(0, 0, 74*displaywidth, 44*displaywidth) Font:15 Text:@"信息类型" Color:UIColorHexValue(0xFF353535)];
        typeLabel.textAlignment = NSTextAlignmentRight;
        [cell.contentView addSubview:typeLabel];
        UILabel *lineLabel = [ZCControl createLabelWithFrame:CGRectMake(82*displaywidth, 14*displaywidth, 0.5*displaywidth, 15*displaywidth) Font:10 Text:nil Color:nil];
        lineLabel.backgroundColor = UIColorHexValue(0xFFB4B4B4);
        [cell.contentView addSubview:lineLabel];
        UILabel *typeContentLabel = [ZCControl createLabelWithFrame:CGRectMake(90*displaywidth, 0, SCREEN_WIDTH-90*displaywidth, 44*displaywidth) Font:15 Text:_typeStr Color:UIColorHexValue(0xFF353535)];
        typeContentLabel.textAlignment = NSTextAlignmentLeft;
        [cell.contentView addSubview:typeContentLabel];
        
    } else if (indexPath.section == 1)
    {
        UILabel *typeLabel = [ZCControl createLabelWithFrame:CGRectMake(0, 20*displaywidth, 74*displaywidth, 20*displaywidth) Font:15 Text:@"发布内容" Color:UIColorHexValue(0xFF353535)];
        typeLabel.textAlignment = NSTextAlignmentRight;
        [cell.contentView addSubview:typeLabel];
        self.textView = [[UITextView alloc] init];
        self.textView.delegate = self;
        _textView.frame = CGRectMake(15*displaywidth, 60*displaywidth, SCREEN_WIDTH-30*displaywidth, 105*displaywidth);
        _textView.font = [UIFont systemFontOfSize:15];
        [cell.contentView addSubview:_textView];
        self.placeholderLabel = [ZCControl createLabelWithFrame:CGRectMake(5*displaywidth, 0, 150*displaywidth, 34*displaywidth) Font:15 Text:@"等待您的输入....." Color:UIColorHexValue(0xFFB4B4B4)];
        _textView.text = _textViewStr;
        if (_textViewStr.length>0) {
            _placeholderLabel.hidden = YES;
        }
        [_textView addSubview:_placeholderLabel];
        self.countLabel = [ZCControl createLabelWithFrame:CGRectMake(SCREEN_WIDTH-30*displaywidth-100*displaywidth, 185*displaywidth-20*displaywidth, 100*displaywidth, 20*displaywidth) Font:15 Text:@"0/200" Color:UIColorHexValue(0xFF353535)];
        _countLabel.textAlignment = NSTextAlignmentRight;
        [cell.contentView addSubview:self.countLabel];
        
    } else if (indexPath.section == 2)
    {
        UILabel *typeLabel = [ZCControl createLabelWithFrame:CGRectMake(0, 20*displaywidth, 74*displaywidth, 20*displaywidth) Font:15 Text:@"图片上传(选填)" Color:UIColorHexValue(0xFF353535)];
        typeLabel.textAlignment = NSTextAlignmentRight;
        [cell.contentView addSubview:typeLabel];
        
        NSInteger itemWidth = 85*displaywidth;
//        NSInteger itemWidth = 85*displaywidth;
        UICollectionViewFlowLayout *flowLayout = [[UICollectionViewFlowLayout alloc] init];
        self.pictureCollectionView = [[UICollectionView alloc] initWithFrame:CGRectMake(15*displaywidth, 60*displaywidth, 285*displaywidth, pictureCellHeight) collectionViewLayout:flowLayout];
        _pictureCollectionView.scrollEnabled = NO;
        _pictureCollectionView.delegate = self;
        _pictureCollectionView.dataSource = self;
        
        if (_imageArr.count>2) {
            pictureCellHeight = (_imageArr.count/3+1)*itemWidth+_imageArr.count/3*15*displaywidth;
        } else {
            pictureCellHeight = itemWidth;
        }
        _pictureCollectionView.frame = CGRectMake(15*displaywidth, 60*displaywidth, 285*displaywidth, pictureCellHeight);
        
        //设置headerView的尺寸大小
        flowLayout.headerReferenceSize = CGSizeMake(265*displaywidth, 0.00001);
        //该方法也可以设置itemSize
        flowLayout.itemSize =CGSizeMake(itemWidth, itemWidth);
        _pictureCollectionView.backgroundColor = [UIColor clearColor];
        [_pictureCollectionView registerClass:[UICollectionViewCell class] forCellWithReuseIdentifier:@"collectionViewCellID"];
        [cell.contentView addSubview:_pictureCollectionView];
        
    } else if (indexPath.section == 3)
    {
        UILabel *typeLabel = [ZCControl createLabelWithFrame:CGRectMake(0, 0, 80*displaywidth, 44*displaywidth) Font:15 Text:@"所在位置:" Color:UIColorHexValue(0xFF353535)];
        typeLabel.textAlignment = NSTextAlignmentRight;
        [cell.contentView addSubview:typeLabel];
        UILabel *typeContentLabel = [ZCControl createLabelWithFrame:CGRectMake(85*displaywidth, 0, SCREEN_WIDTH-85*displaywidth, 44*displaywidth) Font:15 Text:nil Color:UIColorHexValue(0xFF353535)];
        typeContentLabel.textAlignment = NSTextAlignmentLeft;
        typeContentLabel.text = [LTools cacheForKey:SERVER_Address];
        [cell.contentView addSubview:typeContentLabel];
    }
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.section == 0) {
        if (_arr.count>0) {
            LTPickerView* pickerView = [LTPickerView new];
            NSMutableArray *typeArr = @[].mutableCopy;
            for (int i = 0; i<_arr.count; i++) {
                CircleLogisticsTopModel *model = _arr[i];
                [typeArr addObject:model.name];
            }
            pickerView.dataSource = typeArr;//设置要显示的数据
            [pickerView show];
            pickerView.block = ^(LTPickerView* obj,NSString* str,int num){
                _typeStr = str;
                _typeNum = num;
                [_sendTableView reloadData];
            };
        }
    }
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
}

// MARK:collectionview的方法
- (NSInteger)numberOfSectionsInCollectionView:(UICollectionView *)collectionView {
    return 1;
}

- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section {
    if (_imageArr.count==9) {
        return _imageArr.count;
    } else {
        return _imageArr.count+1;
    }
    
}

- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath {
    NSString *ID = @"collectionViewCellID";
    NSInteger itemWidth = 85*displaywidth;
    UICollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:ID forIndexPath:indexPath];
    for (UIView *subView in cell.contentView.subviews) {
        [subView removeFromSuperview];
    }
    UIImageView *pictureImageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, itemWidth, itemWidth)];
    pictureImageView.backgroundColor = [UIColor whiteColor];
    pictureImageView.contentMode = UIViewContentModeScaleAspectFill;
    pictureImageView.clipsToBounds = YES;
    pictureImageView.userInteractionEnabled = YES;
    pictureImageView.tag = indexPath.row + 1000;
    [pictureImageView setContentScaleFactor:[[UIScreen mainScreen] scale]];
    
    if (indexPath.row == self.imageArr.count) {
//                pictureImageView.layer.borderColor = UIColorHexValue(0xFFB4B4B4).CGColor;
//                pictureImageView.layer.borderWidth = 1;
        pictureImageView.backgroundColor = UIColorHexValue(0xFFD9D9D9);
        pictureImageView.image = [UIImage imageNamed:@"lb_icon31"];
        UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(onClickAddPicture)];
        [pictureImageView addGestureRecognizer:tap];
    } else {
        [pictureImageView sd_setImageWithURL:[NSURL URLWithString:_imageArr[indexPath.row]] placeholderImage:nil];
        UIButton *deleteBtn = [[UIButton alloc] initWithFrame:CGRectMake(itemWidth - 22, -7, 30, 30)];
        deleteBtn.backgroundColor = [UIColor clearColor];
        [deleteBtn addTarget:self action:@selector(onClickDeleteBtn:) forControlEvents:UIControlEventTouchUpInside];
        [deleteBtn setImage:[UIImage imageNamed:@"delected"] forState:UIControlStateNormal];
        deleteBtn.tag = indexPath.row;
        [pictureImageView addSubview:deleteBtn];
    }
    
    [cell.contentView addSubview:pictureImageView];
    
    return cell;
}

- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
    if (indexPath.row != self.imageArr.count) {
        if ([self respondsToSelector:@selector(showImageWithIndexPath:)]) {
            [self showImageWithIndexPath:indexPath.row];
        }
    }
}

// MARK: - KSPhotoBrowserDelegate
- (void)ks_photoBrowser:(KSPhotoBrowser *)browser didSelectItem:(KSPhotoItem *)item atIndex:(NSUInteger)index {
    NSLog(@"selected index: %ld", index);
}

- (void)showImageWithIndexPath:(NSInteger)index
{
    [photoArr removeAllObjects];
    
    for (int i = 0; i < _imageArr.count; i++) {
        UICollectionViewCell *cell = (UICollectionViewCell *)[_pictureCollectionView cellForItemAtIndexPath:[NSIndexPath indexPathForRow:i inSection:0]];
        UIImageView *imageView = [cell.contentView viewWithTag:i+1000];
        KSPhotoItem *item = [KSPhotoItem itemWithSourceView:imageView imageUrl:[NSURL URLWithString:_imageArr[i]]];
        [photoArr addObject:item];
    }
    KSPhotoBrowser *ksBrowser = [KSPhotoBrowser browserWithPhotoItems:photoArr selectedIndex:index];
    [KSPhotoBrowser setImageManagerClass:KSYYImageManager.class];
    ksBrowser.delegate = self;
    ksBrowser.dismissalStyle = KSPhotoBrowserInteractiveDismissalStyleRotation;
    ksBrowser.backgroundStyle = KSPhotoBrowserBackgroundStyleBlurPhoto;
    ksBrowser.loadingStyle = KSPhotoBrowserImageLoadingStyleIndeterminate;
    ksBrowser.pageindicatorStyle = KSPhotoBrowserPageIndicatorStyleText;
    ksBrowser.bounces = NO;
    [ksBrowser showFromViewController:self];
}

- (void)pickImageFromAlbum {
    TZImagePickerController *moreChoseImagePicker = [[TZImagePickerController alloc] initWithMaxImagesCount:9 delegate:self];
    moreChoseImagePicker.maxImagesCount = 9 - _imageArr.count;
    moreChoseImagePicker.allowPickingVideo = NO;
    moreChoseImagePicker.allowTakePicture = NO;
    [self presentViewController:moreChoseImagePicker animated:YES completion:nil];
}

// MARK:TZImagePickerController
- (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingPhotos:(NSArray<UIImage *> *)photos sourceAssets:(NSArray *)assets isSelectOriginalPhoto:(BOOL)isSelectOriginalPhoto
{
    WEAKSELF;
    [HttpTool uploadImageWithPath:@"/file/upload" params:nil thumbName:@"file" ImageAry:photos success:^(id json)
     {
//         NSArray *imgArray = json[@"data"];
//         if (imgArray.count < 2)
//         {
//             [LTools showMBProgressWithText:@"图片上传出现问题，请重新上传" addToView:weakSelf.view];
//             return;
//         }
         
         if ([json server_Getcodecheck])
         {
//             NSString *address = [NSString stringWithFormat:@"%@%@",areaLab.text,addressField.text];
//             NSDictionary *dic = @{@"linkman":nameField.text,
//                                   @"address":address,
//                                   @"phone":phoneField.text,
//                                   @"password":passwordField.text,
//                                   @"code":codeField.text,
//                                   @"type":@"1",
//                                   @"signboardImg":imgArray[0],
//                                   @"cardImg":imgArray[1],
//                                   @"companyName":companyField.text,
//                                   @"serveId":_companyTypeId,
//                                   @"username":nameField.text
//                                   };
             NSArray *dataArr = json[@"data"];
             [_imageArr addObjectsFromArray:dataArr];
             [_sendTableView reloadData];
             [_pictureCollectionView reloadData];
         }
         else
         {
             [LTools showMBProgressWithText:json[@"msg"] addToView:weakSelf.view];
         }
     } failure:^(NSError *error) {
         
     } progress:^(CGFloat progress) {
         
     }];
//    [self.imageArr addObjectsFromArray:photos];
}

//需求：相册里的视频隐藏不给选。(不知道后面会不会又要选视频先留着)
- (void)imagePickerController:(TZImagePickerController *)picker didFinishPickingVideo:(UIImage *)coverImage sourceAssets:(id)asset
{
    
}

// MARK: UITextViewDelegate
- (void)textViewDidChange:(UITextView *)textView
{
    if (textView.text.length > 0) {
        self.placeholderLabel.hidden = YES;
    } else {
        self.placeholderLabel.hidden = NO;
    }
    _textViewStr = textView.text;
    int count;
    count = (int)textView.text.length;
    [self.countLabel setText:[NSString stringWithFormat:@"%d/200", count]];  //countLabel是一个显示剩余可输入数字的label
    
}

//限制textView输入字数
-(BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString*)text
{
    //这个判断相当于是textfield中的点击return的代理方法
    if ([text isEqualToString:@"\n"]) {
        [textView resignFirstResponder];
        return NO;
    }
    
    //在输入过程中 判断加上输入的字符 是否超过限定字数
    NSString *str = [NSString stringWithFormat:@"%@%@", textView.text, text];
    if (str.length > 200)
    {
        self.placeholderLabel.hidden = YES;
        textView.text = [str substringToIndex:200];
        [self.countLabel setText:@"200/200"];
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:nil message:@"输入的内容超过限制" delegate:self cancelButtonTitle:@"确定" otherButtonTitles:nil];
        [alert show];
        
        return NO;
    }else{
        NSLog(@"%lu",(unsigned long)textView.text.length);
    }
    return YES;
}

- (void)scrollViewWillBeginDragging:(UIScrollView*)scrollView
{
    [self.view endEditing:YES];
}

- (void)onClickDeleteBtn:(UIButton *)sender {
    [_imageArr removeObjectAtIndex:sender.tag];
    [_pictureCollectionView reloadData];
    [_sendTableView reloadData];
}

- (void)onClickAddPicture {
    [self pickImageFromAlbum];
}

- (void)agreementAction:(UIButton *)sender {
    sender.selected = !sender.selected;
    if (sender.selected) {
        agreementIsSelect = NO;
        [sender setImage:[UIImage imageNamed:@"gouxuan1"] forState:UIControlStateNormal];
    } else {
        agreementIsSelect = YES;
        [sender setImage:[UIImage imageNamed:@"gouxuan2"] forState:UIControlStateNormal];
    }
}

- (void)sendAgreementAction {
    ReleaseNotesViewController *vc = [[ReleaseNotesViewController alloc] init];
    [self.navigationController pushViewController:vc animated:YES];
}

- (void)onClickSendBtn {
    if (agreementIsSelect) {
        WEAKSELF;
        NSString *imageStr;
        for (int i = 0; i<_imageArr.count; i++) {
            if (i==0) {
                imageStr = _imageArr[i];
            } else {
                imageStr = [NSString stringWithFormat:@"%@,%@",imageStr, _imageArr[i]];
            }
        }
        CircleLogisticsTopModel *model = _arr[_typeNum];
        if (_typeNum<0) {
            [LTools showMBProgressWithText:@"请选择信息类型" addToView:self.view];
            return;
        }
        if (_textView.text.length==0) {
            [LTools showMBProgressWithText:@"请输入发布内容" addToView:self.view];
            return;
        }
        
        [HYBaseHandler requestWithTheFormUrl:SERVER_CircleLogisticsSend Parmers:@{@"tagId":model.ID, @"content":_textView.text, @"imgs": imageStr, @"location":[LTools cacheForKey:SERVER_Address], @"Token":[LTools cacheForKey:SERVER_LoginToken], @"lng":[LTools cacheForKey:SERVER_longitude], @"lat":[LTools cacheForKey:SERVER_latitude], @"city":[LTools cacheForKey:SERVER_City]} Success:^(id obj)
         {
             if ([obj server_Getcodecheck])
             {
                 [self.navigationController popViewControllerAnimated:YES];
             }
             else
             {
                 [LTools showMBProgressWithText:obj[@"msg"] addToView:weakSelf.view];
             }
         } failed:^(NSError *error) {
             
         }];
    } else {
        [LTools showMBProgressWithText:@"请先勾选协议,才可发布" addToView:self.view];
        return;
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
